<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>genshi.path</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="genshi-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="../index.html">Documentation Index</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="genshi-module.html">Package&nbsp;genshi</a> ::
        Module&nbsp;path
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module path</h1><p class="nomargin-top"></p>
<p>Basic support for evaluating XPath expressions against streams.</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> genshi.input <span class="py-keyword">import</span> XML
<span class="py-prompt">&gt;&gt;&gt; </span>doc = XML(<span class="py-string">'''&lt;doc&gt;</span>
<span class="py-more">... </span><span class="py-string"> &lt;items count=&quot;4&quot;&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;item status=&quot;new&quot;&gt;</span>
<span class="py-more">... </span><span class="py-string">        &lt;summary&gt;Foo&lt;/summary&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;/item&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;item status=&quot;closed&quot;&gt;</span>
<span class="py-more">... </span><span class="py-string">        &lt;summary&gt;Bar&lt;/summary&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;/item&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;item status=&quot;closed&quot; resolution=&quot;invalid&quot;&gt;</span>
<span class="py-more">... </span><span class="py-string">        &lt;summary&gt;Baz&lt;/summary&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;/item&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;item status=&quot;closed&quot; resolution=&quot;fixed&quot;&gt;</span>
<span class="py-more">... </span><span class="py-string">        &lt;summary&gt;Waz&lt;/summary&gt;</span>
<span class="py-more">... </span><span class="py-string">      &lt;/item&gt;</span>
<span class="py-more">... </span><span class="py-string">  &lt;/items&gt;</span>
<span class="py-more">... </span><span class="py-string">&lt;/doc&gt;'''</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> doc.select(<span class="py-string">'items/item[@status=&quot;closed&quot; and '</span>
<span class="py-more">... </span>    <span class="py-string">'(@resolution=&quot;invalid&quot; or not(@resolution))]/summary/text()'</span>)
<span class="py-output">BarBaz</span></pre>
<p>Because the XPath engine operates on markup streams (as opposed to tree
structures), it only implements a subset of the full XPath 1.0 language.</p>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Classes</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="genshi.path.Path-class.html" class="summary-name">Path</a><br />
      Implements basic XPath support on streams.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="genshi.path.PathSyntaxError-class.html" class="summary-name">PathSyntaxError</a><br />
      Exception raised when an XPath expression is syntactically incorrect.
    </td>
  </tr>
</table>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="genshi-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="../index.html">Documentation Index</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed Jul  9 18:16:20 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
